home *** CD-ROM | disk | FTP | other *** search
/ Euroscene 2 / Euroscene 2.iso / USEFUL / DeliTracker130 / Developer / Developer.run / Examples / Hippel.s < prev    next >
Encoding:
Text File  |  1992-09-23  |  4.2 KB  |  232 lines

  1.  
  2.     incdir    "Includes:"
  3.     include "misc/DeliPlayer.i"
  4.  
  5. ;
  6. ;
  7.     SECTION Player,Code
  8. ;
  9. ;
  10.  
  11.     PLAYERHEADER PlayerTagArray
  12.  
  13.     dc.b '$VER: Jochen Hippel player module V1.2 (06 Sep 92)',0
  14.     even
  15.  
  16. PlayerTagArray
  17.     dc.l    DTP_PlayerVersion,1
  18.     dc.l    DTP_PlayerName,PName
  19.     dc.l    DTP_Creator,CName
  20.     dc.l    DTP_Check2,Chk
  21.     dc.l    DTP_Interrupt,Int
  22.     dc.l    DTP_InitPlayer,InitPlay
  23.     dc.l    DTP_EndPlayer,EndPlay
  24.     dc.l    DTP_InitSound,InitSnd
  25.     dc.l    DTP_EndSound,RemSnd
  26.     dc.l    DTP_PrevSong,PrevSub
  27.     dc.l    DTP_NextSong,NextSub
  28.     dc.l    TAG_DONE
  29.  
  30. *-----------------------------------------------------------------------*
  31. ;
  32. ; Player/Creatorname und lokale Daten
  33.  
  34. PName    dc.b 'Hippel',0
  35. CName    dc.b 'Jochen Hippel,',10
  36.     dc.b 'adapted by Delirium',0
  37.     even
  38. H_data        dc.l 0
  39. H_offset    dc.l 0
  40. H_offset2    dc.l 0
  41.  
  42. *-----------------------------------------------------------------------*
  43. ;
  44. ;Interrupt für Replay
  45.  
  46. Int
  47.     movem.l    d2-d7/a2-a6,-(sp)
  48.     move.l    H_offset(pc),a0
  49.     jsr    (a0)                ; DudelDiDum
  50.     movem.l    (sp)+,d2-d7/a2-a6
  51.     rts
  52.  
  53. *-----------------------------------------------------------------------*
  54. ;
  55. ; Testet, ob es sich um ein Hippel-Modul handelt
  56.  
  57. Chk
  58.     move.l    dtg_ChkData(a5),a0
  59.  
  60.     moveq    #-1,d0                ; Modul nicht erkannt (default)
  61.  
  62.     cmpi.b    #$60,(a0)            ; bra.s
  63.     bne.s    Chk2
  64.     cmpi.b    #$60,2(a0)            ; bra.s
  65.     bne.s    Chk2
  66.     cmpi.w    #$48e7,4(a0)            ; movem
  67.     bne.s    Chk2
  68.     addq.l    #2,a0                ; short branch
  69.     bra.s    ChkOk
  70. Chk2
  71.     cmpi.b    #$60,(a0)            ; bra.s
  72.     bne.s    Chk3
  73.     cmpi.b    #$60,2(a0)            ; bra.s
  74.     bne.s    Chk3
  75.     cmpi.w    #$41fa,4(a0)            ; lea
  76.     bne.s    Chk3
  77.     addq.l    #2,a0                ; short branch
  78.     bra.s    ChkOk
  79. Chk3
  80.     cmpi.w    #$6000,(a0)            ; bra
  81.     bne.s    Chk4
  82.     cmpi.w    #$6000,4(a0)            ; bra
  83.     bne.s    Chk4
  84.     cmpi.w    #$48e7,8(a0)            ; movem
  85.     bne.s    Chk4
  86.     addq.l    #4,a0                ; long branch
  87.     bra.s    ChkOk
  88. Chk4
  89.     cmpi.w    #$6000,(a0)            ; bra
  90.     bne.s    ChkEnd
  91.     cmpi.w    #$6000,4(a0)            ; bra
  92.     bne.s    ChkEnd
  93.     cmpi.w    #$6000,8(a0)            ; bra
  94.     bne.s    ChkEnd
  95.     cmpi.w    #$6000,12(a0)            ; bra
  96.     bne.s    ChkEnd
  97.     cmpi.w    #$48e7,16(a0)            ; movem
  98.     bne.s    ChkEnd
  99.     addq.l    #4,a0                ; long branch
  100. ChkOk
  101.     move.l    a0,H_offset2            ; IRQ offset
  102.     moveq    #0,d0                ; Modul erkannt
  103. ChkEnd
  104.     rts
  105.  
  106. *-----------------------------------------------------------------------*
  107. ;
  108. ; Init Player
  109.  
  110. InitPlay
  111.     moveq    #0,d0
  112.     move.l    dtg_GetListData(a5),a0        ; Function
  113.     jsr    (a0)
  114.     move.l    a0,H_data
  115.  
  116.     move.l    H_offset2(pc),H_offset        ; Copy IRQ
  117.  
  118.     move.w    #1,dtg_SndNum(a5)        ; First Subsong
  119.  
  120.     move.l    dtg_AudioAlloc(a5),a0        ; Function
  121.     jsr    (a0)                ; returncode is already set !
  122.     rts
  123.  
  124. *-----------------------------------------------------------------------*
  125. ;
  126. ; End Player
  127.  
  128. EndPlay
  129.     move.l    dtg_AudioFree(a5),a0        ; Function
  130.     jsr    (a0)
  131.     rts
  132.  
  133. *-----------------------------------------------------------------------*
  134. ;
  135. ; Init Sound
  136.  
  137. InitSnd
  138.     bsr    ClearAudio
  139.  
  140.     bsr    ClearRegs
  141.  
  142.     moveq    #0,d0
  143.     move.w    dtg_SndNum(a5),d0
  144.     move.l    H_data(pc),a0
  145.     jsr    (a0)                ; Init Sound
  146.     rts
  147.  
  148. *-----------------------------------------------------------------------*
  149. ;
  150. ; Remove Sound
  151.  
  152. RemSnd
  153.     bsr    ClearRegs
  154.  
  155.     moveq    #0,d0
  156.     move.l    H_data(pc),a0
  157.     jsr    (a0)                ; End Sound
  158.  
  159.     bsr    ClearAudio
  160.     rts
  161.  
  162. *-----------------------------------------------------------------------*
  163. ;
  164. ; Play Next Pattern
  165.  
  166. NextSub
  167.     move.l    dtg_StopInt(a5),a0
  168.     jsr    (a0)                ; Sound Aus
  169.     bsr    RemSnd
  170.     addq.w    #1,dtg_SndNum(a5)        ; Nächster Sound
  171.     bsr    InitSnd
  172.     move.l    dtg_StartInt(a5),a0
  173.     jsr    (a0)                ; Sound An
  174. NextSubEnd
  175.     rts
  176.  
  177. *-----------------------------------------------------------------------*
  178. ;
  179. ; Play Previous Pattern
  180.  
  181. PrevSub
  182.     cmpi.w    #1,dtg_SndNum(a5)
  183.     beq.s    PrevSubEnd
  184.  
  185.     move.l    dtg_StopInt(a5),a0
  186.     jsr    (a0)                ; Sound Aus
  187.     bsr    RemSnd
  188.     subq.w    #1,dtg_SndNum(a5)        ; Vorheriger Sound
  189.     bsr    InitSnd
  190.     move.l    dtg_StartInt(a5),a0
  191.     jsr    (a0)                ; Sound An
  192. PrevSubEnd
  193.     rts
  194.  
  195. *-----------------------------------------------------------------------*
  196. ;
  197. ; Löscht einige Hardware-Register
  198.  
  199. ClearAudio
  200.     moveq    #0,d0
  201.     lea    $dff000,a0
  202.     move.w    d0,$a8(a0)
  203.     move.w    d0,$b8(a0)
  204.     move.w    d0,$c8(a0)
  205.     move.w    d0,$d8(a0)
  206.     move.w    #$f,$96(a0)
  207.     rts
  208.  
  209. *-----------------------------------------------------------------------*
  210. ;
  211. ; Löscht einige Register (wegen unzureichender Initialisierung in manchen Modulen)
  212.  
  213. ClearRegs
  214.     moveq    #0,d0
  215.     moveq    #0,d1
  216.     moveq    #0,d2
  217.     moveq    #0,d3
  218.     moveq    #0,d4
  219.     moveq    #0,d5
  220.     moveq    #0,d6
  221.     moveq    #0,d7
  222.  
  223.     suba.l    a0,a0
  224.     suba.l    a1,a1
  225.     suba.l    a2,a2
  226.     suba.l    a3,a3
  227.     suba.l    a4,a4
  228.     rts
  229.  
  230. *-----------------------------------------------------------------------*
  231.  
  232.